﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using T6._2.Models;

namespace T6._2.Controllers
{
    public class AdminController : Controller
    {
        // GET: Admin
        public ActionResult Index()
        {
            return View();
        }
        public ActionResult Login()
        {
            return View();
        }
        [HttpPost]
        public ActionResult Login(Sysuser admin)
        {
            using (fashionshoppingDBEntities db=new fashionshoppingDBEntities())
            {
                if (ModelState.IsValid)
                {
                    var u = db.Sysuser.FirstOrDefault(x => x.username == admin.username && x.pwd == admin.pwd);
                    if (u == null)
                    {
                        ModelState.AddModelError("", "邮箱或者密码有误");
                    }
                    
                }
            }
            return View();
        }
    }
}